//
//  YNOrgTree.h
//  Messenger
//
//  Created by OC on 15/1/15.
//  Copyright (c) 2015年 李健. All rights reserved.
//
//  组织机构实体类
//

#import <Foundation/Foundation.h>

@class FMDatabase;
@interface YNOrgTree : NSObject

//orgNo组织机构ID
@property (nonatomic, strong) NSString *orgNo;

//orgName组织名称
@property (nonatomic, strong) NSString *orgName;

//ordId排序号
@property (nonatomic) int ordId;

//orgType组织类型 1-行政线，教学线  2-行政班  3-教学班 4-实习活动
@property (nonatomic)  int orgType;

//parentOrgNo上级（父）ID,为0表示是根节点
@property (nonatomic, strong) NSString *parentOrgNo;

//profile简介，描述
@property (nonatomic, strong) NSString *profile;

//removeTag删除标志1：表示该组织机构无效，无需显示  0：有效
@property (nonatomic) int removeTag;
//用户总人数
@property (nonatomic) NSInteger userCount;
/**HX** 黄旭添加-在线人数 **/
@property(nonatomic) NSInteger onlineUserCount;

//创建组织机构表
+ (BOOL)createInDatabase:(FMDatabase *)db;

//插入组织机构信息
- (BOOL)insertInDatabase:(FMDatabase *)db;

//更新组织机构信息
- (BOOL)updateInDatabase:(FMDatabase *)db;

//判断组织机构是否存在
- (BOOL)isOrgTreeExistInDatabase:(FMDatabase *)db;

//获取组织机构数据库数据条数
+ (NSUInteger)getOrgTreeDataCountInDatabase:(FMDatabase *)db;

//根据orgNo查询组织机构信息
- (NSArray *)queryByOrgNoInDatabase:(FMDatabase *)db;

//删除表中所有数据
+ (BOOL)deleteAllOrgTreeDataInDatabase:(FMDatabase *)db;

//2016-9-9jc修改，逻辑删除表中所有数据
+(BOOL)logicDeleteAllOrgTreeDataInDatabase:(FMDatabase *)db;

//2016-9-9jc修改，判断组织机构是否存在
- (BOOL)logicIsOrgTreeExistInDatabase:(FMDatabase *)db;

//根据parentOrgNo查询组织机构信息
+ (NSArray *)queryAllByParentOrgNo:(NSString *)parentOrgNo database:(FMDatabase *)db;

//根据parentOrgNo查询联系人中组织机构信息
+ (NSArray *)queryControllerByParentOrgNo:(NSString *)parentOrgNo getAllStudent:(BOOL)allStudent database:(FMDatabase *)db;

//根据parentOrgNo查询组织机构中组织机构信息
+ (NSArray *)queryOrganizationByParentOrgNo:(NSString *)parentOrgNo database:(FMDatabase *)db;

//根据parentOrgNo查询组织机构中组织机构信息-只查-老师-实习活动
+ (NSArray *)queryOrganizationInternshipByParentOrgNo:(NSString *)parentOrgNo database:(FMDatabase *)db;

//根据parentOrgNo查询组织机构信息
+ (NSArray *)queryByParentOrgNo:(NSString *)parentOrgNo database:(FMDatabase *)db;

+ (NSMutableArray *)queryParentOrgByParentOrgNo:(NSString *)parentOrgNo database:(FMDatabase *)db;



//根据关键字查询OrgTree
+ (NSArray *)queryOrgTreeByKeywords:(NSString *)keyWords database:(FMDatabase *)db orgType:(NSInteger)orgType;

//根据parentOrgNoS查询联系人中组织机构信息-可分页查询
+ (NSArray *)queryControllerByOrgNoStringS:(NSString*)parentOrgNoS getAllStudent:(BOOL)allStudent limitStart:(NSUInteger)start limitLength:(NSUInteger)length database:(FMDatabase *)db;


@end
